package com.wechat.apidoc;

import com.wechat.entity.User;
import com.wechat.utils.ActionResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 *
 * @author cgc
 * @date 2018/4/2
 */
@Api(description = "微信用户相关接口")
public interface WxMaUserInterface {

    @ApiOperation(value = "用户登录", notes = "返回用户秘钥在微信小程序storage保存")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", value = "用户登录凭证（有效期五分钟）", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(name = "signature", value = "wx.getUserInfo(OBJECT)返回", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(name = "rawData", value = "wx.getUserInfo(OBJECT)返回", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(name = "encryptedData", value = "wx.getUserInfo(OBJECT)返回", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(name = "iv", value = "wx.getUserInfo(OBJECT)返回", paramType = "query", required = true, dataType = "String")
    })
    ActionResult login(String code, String signature, String rawData, String encryptedData, String iv);

    @ApiOperation(value = "获取用户信息", response = User.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "key", value = "用户秘钥", paramType = "query", required = true, dataType = "String")
    })
    ActionResult info(String key);

}
